package edu.java.water.mapper;

import edu.java.water.entity.ProductNormEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Mapper
@Repository
public interface ProductNormMapper {
    @Select("select *,min(norm.price) as priceMin,max(norm.price) as priceMax from product p left join norm on p.id=norm.product_id where state = 1 group by p.id order by p.id")
    ArrayList<ProductNormEntity> selectProductNorm();
    @Select("select *,min(norm.price) as priceMin,max(norm.price) as priceMax from product p left join norm on (p.id=norm.product_id) where state = 1 and p.product_name like #{search} group by p.id order by p.id ")
    ArrayList<ProductNormEntity> searchProductNorm(String search);
}
